<template>
	<view class="column-content">
	<!-- 	<view class="grid-content">
			<view class="type_cell" v-for="(emoji,index) in emojis" :key="index" @tap="currentIndexTap(index)">{{emoji.name}}</view>
		</view> -->
		<swiper class="scroll_view_content" indicator-dots="true" :current="currentIndex">
			<swiper-item v-for="(emoji,index) in emojis" :key="index">
				<scroll-view class="scroll_view_content" scroll-y>
					<view class="grid-content">
						<view class="emoji_cell" v-for="(item,i) in emoji.items" :key="i">
							<image class="emoji_image" mode="aspectFit" :src="'https://bbs.uestc.edu.cn/'+item.src" @tap="emojiTap(item)"></image>
						</view>
					</view>
				</scroll-view>
			</swiper-item>
		</swiper>
		
	</view>
</template>

<script>
	import emoji from "../static/emoji.js"
	export default {
		name:"emoji-view",
		data() {
			return {
				emojis:[],
				currentIndex:0
			};
		},
		mounted() {
			this.emojis = [
				{
					name:"兔斯基",
					items:emoji.too
				},
				{
					name:"洋葱头",
					items:emoji.yang
				},
				{
					name:"蘑菇头",
					items:emoji.mushroom
				},
				{
					name:"阿鲁",
					items:emoji.alu
				}
			]
		},
		methods:{
			emojiTap(item){
				this.$emit('emojiTap',item)
			},
			currentIndexTap(index){
				this.currentIndex = index
			}
		}
	}
</script>

<style lang="scss">
	.scroll_view_content{
		height: 600upx;
		width: 100vw;
		border-radius: 20upx;
		background-color: #fff;
		padding-bottom: 0;
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
	}
	.emoji_cell{
		display: flex;
		width: 25%;
		height: 160upx;
		justify-content: center;
		align-items: center;
	}
	.emoji_image{
		width: 100upx;
		height: 100upx;
	}
	
	.type_cell{
		display: flex;
		justify-content: center;
		align-items: center;
		border: 1px solid $uni-global-green-color;
		color: $uni-global-green-color;
		font-size: 30upx;
		height: 60upx;
		border-radius: 6upx;
		margin-left: 30upx;
		margin-top: 20upx;
		padding-left: 30upx;
		padding-right: 30upx;
		white-space: nowrap;
	}
</style>
